package com.sinaapp.gavinzhang.jianzhioffer;

import java.util.Stack;

/**
 * 两个栈实现队列
 * Created by gavin on 15-9-3.
 */
public class TwoStaticQueue {
    public static void main(String[] args)
    {

    }

    static Stack<Integer> stack1 = new Stack<Integer>();
    static Stack<Integer> stack2 = new Stack<Integer>();

    public static void push(int node) {
        stack1.push(node);
    }

    public static int pop() {
        while (stack1.size() != 1)
        {
            stack2.push(stack1.pop());
        }
        int tmp = stack1.pop();
        while (stack2.size() != 0)
        {
            stack1.push(stack2.pop());
        }
        return tmp;
    }
}
